home *** CD-ROM | disk | FTP | other *** search
/ Day Cry / Day Cry CD.bin / oh_towns / taropyon / splib / splib.lzh / PRG / ZNSPLAY / ZNSLIB01.C < prev    next >
C/C++ Source or Header  |  1993-03-16  |  2KB  |  91 lines

  1. #include    <stdio.h>
  2. #include    <stdlib.h>
  3.  
  4. #include    <egb.h>
  5. #include    <snd.h>
  6. #include    "znsplay.h"
  7.  
  8.  
  9. int        ZnsSwPort = 2;
  10.  
  11. #define    _SND_BIOS
  12.  
  13. #ifndef    _SND_BIOS
  14. #    define    GET_SW    {                                            \
  15.         sw = ( (_inb( 0x4D0 ) & _inb( 0x4D2 )) ^ 0xFF) & 0x30;    \
  16.     }
  17. #else
  18. #    define    GET_SW    {                    \
  19.         int        sw1, sw2;                \
  20.         if ( ZnsSwPort & 1 )            \
  21.             SND_joy_in_1( 0, &sw1 );    \
  22.         else                            \
  23.             sw1 = 0x30;                    \
  24.         if ( ZnsSwPort & 2 )            \
  25.             SND_joy_in_1( 1, &sw2 );    \
  26.         else                            \
  27.             sw2 = 0x30;                    \
  28.         sw = ( ~(sw1 & sw2)) & 0x30;    \
  29.     }
  30. #endif
  31.  
  32. int        ZnsNextCheck(void)
  33. {
  34.     int        sw;
  35.  
  36. /*    Æìê╙:sw ëƒé│éΩé─éóéΘé╞bit off ëƒé│éΩé─é╚éóé╞bit on     */
  37. #ifndef    _SND_BIOS
  38.     _outb( 0x4D6, 0xFF );        /* end check */
  39. #endif
  40.  
  41.     GET_SW;
  42.     if( sw == 0 )
  43.         return 0;
  44. c01:
  45.     GET_SW;
  46.     if( sw & 0x10 )
  47.     {
  48.         while( sw == 0x30 )
  49.         {
  50.             GET_SW;
  51.         }
  52.         if( sw == 0x20 )
  53.             goto c02;
  54.         while( sw )
  55.         {
  56.             GET_SW;
  57.             if( sw == 0x30 )
  58.                 break;
  59.         }
  60.         return 1;
  61.     }
  62. c02:
  63.     if( sw )
  64.         goto c01;
  65.     return (-1);
  66. }
  67.  
  68. void    ZNS_cls(void)
  69. {
  70.     DSP_writePage(0);
  71.     EGB_color( EgbPtr, 1, 0 );
  72.     EGB_clearScreen( EgbPtr );
  73.  
  74.     DSP_writePage(1);
  75.     boxf( DspCtrl.scinf[1].sc.x1, DspCtrl.scinf[1].sc.y1 + 24,
  76.           DspCtrl.scinf[1].sc.x2, DspCtrl.scinf[1].sc.y2 - 16, PSET, 0 );
  77. }
  78.  
  79. void    ZNS_frame( FRAME *fr )
  80. {
  81.     DSP_writePage(1);
  82.     DSP_view2( DspCtrl.scinf[1].sc.x1, DspCtrl.scinf[1].sc.y1 + 24,
  83.               DspCtrl.scinf[1].sc.x2, DspCtrl.scinf[1].sc.y2 - 16 );
  84.  
  85.     box( fr->x1-1, fr->y1-1, fr->x2+1, fr->y2+1, PSET,C_MBLACK);
  86.     box( fr->x1-2, fr->y1-2, fr->x2+2, fr->y2+2, PSET,C_WHITE);
  87.  
  88.     DSP_view( &(DspCtrl.scinf[1].sc) );
  89. }
  90.  
  91.